package app.base;


import android.app.Activity;
import android.content.DialogInterface;
import android.os.Build;
import android.text.SpannableStringBuilder;
import android.util.DisplayMetrics;
import cn.cheln.support.dialog.DialogUtil;
import cn.cheln.support.dialog.DialogUtil.DialogAbstract;
import cn.cheln.support.log.Logs;

public class Test {

	public static void showDensity(final Activity activity) {
		DialogAbstract dialogInfo = new DialogAbstract();
		dialogInfo.context = activity;
		DisplayMetrics metric = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(metric);
		int width = metric.widthPixels; 
		int height = metric.heightPixels; 
		float density = metric.density; 
		int densityDpi = metric.densityDpi; 

		dialogInfo.message = new SpannableStringBuilder("density = " + density
				+ " width = " + width + " height = " + height
				+ " densityDpi = " + densityDpi + " device = " + Build.MODEL);
		Logs.i("--- "+dialogInfo.message);
		dialogInfo.positiveButtonText = "Yes";
		dialogInfo.positiveButtonClickListener = new DialogUtil.DialogClicker() {

			@Override
			public void onClick(DialogInterface dialog, int arg1) {
				// TODO Auto-generated method stub

				super.onClick(dialog, arg1);
			}
		};

		dialogInfo.negativeButtonText = "Nupe";
		dialogInfo.negativeButtonClickListener = new DialogUtil.DialogClicker() {

			@Override
			public void onClick(DialogInterface dialog, int which) {
				// TODO Auto-generated method stub
				super.onClick(dialog, which);
				// activity.startActivity(new Intent(activity, ASite.class));

			}
		};
		DialogUtil.showChoiceDialog(dialogInfo, true);
	}
}
